#include "main_home.h"
#include <QVBoxLayout>
#include <QPushButton>
#include <QLabel>
#include <QPixmap>
#include <QPalette>
#include <QDebug>
#include "ui_main_home.h"

MainWidget::MainWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::MainWidget) {
    ui->setupUi(this);

    QPushButton *button = new QPushButton("查询航班", this);
    button->setGeometry(620, 490, 200, 50);

    QPushButton *loginButton = new QPushButton("登录", this);
    loginButton->setGeometry(620, 570, 200, 50);

    // 连接按钮点击信号到槽函数，通知主窗口打开地图界面
    connect(button, &QPushButton::clicked, this, &MainWidget::openResult);
    connect(loginButton, &QPushButton::clicked, this, &MainWidget::showLogin);

}

void MainWidget::paintEvent(QPaintEvent *event) {
    QPainter painter(this);
    QPixmap backgroundPixmap("C:/Users/LEO/Desktop/study/QT/flights/img/mainBack.jpg");

    painter.drawPixmap(0, 0, this->width(), this->height(), backgroundPixmap);
}



